const BASE_URL = "http://localhost:8082"

export const hRequest = function(options) {
	return new Promise((resolve, reject) => {
		uni.request({
			method: options.methods,
			url: BASE_URL + options.url,
			data: options.data || {},
			success: (res) => {
				if (res.data.status !== 0) {
					return uni.showToast({
						icon: "none",
						title: "获取数据失败"
					})
				}
				resolve(res)
			},
			fail: (err) => {
				return uni.showToast({
					icon: "none",
					title: "请求接口失败！！！"
				})
				reject(err)
			}
		})
	})
}
